package com.munisense.webservices.javaclient;

/**
 * Container class to hold the service configuration parameters.
 */
public class ServiceConf {
	
	private String host;
	private String user;
	private String password;
	
	private boolean enableLogging;
	private boolean allowUnverifiedHost;
	
	/**
	 * Constructor 
	 * 
	 * @param host Name of the webservice host
	 * @param user Username
	 * @param password Password
	 * @param allowUnverifiedHost Whether to allow unverified HTTPS hosts
	 * @param enableLogging Whether to log the communication from/to the webservice
	 */
	public ServiceConf(String host, String user, String password, boolean allowUnverifiedHost, boolean enableLogging) {
		this.host = host;
		this.user = user;
		this.password = password;
		this.enableLogging = enableLogging;
		this.allowUnverifiedHost = allowUnverifiedHost;
	}
	
	/**
	 * Default Constructor which disables logging and unverified hosts.
	 * Advised for production usage.
	 * 
	 * @param host Name of the webservice host
	 * @param user Username
	 * @param password Password
	 */
	public ServiceConf(String host, String user, String password) {
		this.host = host;
		this.user = user;
		this.password = password;
		this.enableLogging = false;
		this.allowUnverifiedHost = false;
	}

	/**
	 * Is Logging
	 * 
	 * @return Whether or not this configuration is set to log.
	 */
	public boolean isEnableLogging() {
		return enableLogging;
	}

	/**
	 * Set Logging
	 * 
	 * @param enableLogging Whether the logging is enabled or not
	 */
	public void setEnableLogging(boolean enableLogging) {
		this.enableLogging = enableLogging;
	}

	/**
	 * Is Allow Unverified Host
	 * 
	 * @return Whether or not this configuration allows unverified HTTPS hosts
	 */
	public boolean isAllowUnverifiedHost() {
		return allowUnverifiedHost;
	}

	/**
	 * Set Allow Unverified Host
	 * 
	 * @param allowUnverifiedHost Whether or not this configuration allows unverified HTTPS hosts
	 */
	public void setAllowUnverifiedHost(boolean allowUnverifiedHost) {
		this.allowUnverifiedHost = allowUnverifiedHost;
	}

	/**
	 * @return the host
	 */
	public String getHost() {
		return host;
	}

	/**
	 * @param host the host to set
	 */
	public void setHost(String host) {
		this.host = host;
	}

	/**
	 * @return the user
	 */
	public String getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(String user) {
		this.user = user;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}
	
}
